package com.jesper.seckill.constant;

/**
 * redis key值前缀
 */
public class RedisKeyPrefix {

    private static final String BASE_KEY = "mallchat:";

    /**
     * 用户信息
     */
    public static final String USER_INFO_STRING = "userInfo:uid_%d";

    /**
     * 用户token存放
     */
    public static final String USER_TOKEN_STRING = "userToken:uid_%d";

    /**
     * 秒杀商品列表
     */
    public static final String SEC_KILL_GOOD = "secKillGood";

    /**
     * 秒杀商品详情
     */
    public static final String SEC_KILL_GOOD_INFO = "secKillGood:goodsId_%d";

    /**
     * 用户对应秒杀成功商品信息
     */
    public static final String USER_SUCCESS_SEC_KILL_GOOD_INFO = "userSuccessSecKillGoodInfo:userId_%d_goodsId_%d";

    public static String getKey(String key, Object... objects) {
        return BASE_KEY + String.format(key, objects);
    }

}
